<html><head><title>Validation</title></head><body>
<?php
/*
this is a good thing !
this is a modification
*/
require('./db.php');

$Cmt_id = @$_GET['id'];
$Action = @$_GET['action'];

if(is_numeric($Cmt_id)){
switch ($Action)
{
  case 'valider' :
    $query = "update commentaires set valide='oui' where id = $Cmt_id";
	$rslt_query = mysql_query($query);
	if($rslt_query){
	echo "commentaire valider !<br/>";
	}
    break;
  case 'supprimer' :
    $query = "delete from commentaires where id = $Cmt_id";
	$rslt_query = mysql_query($query);
	if($rslt_query){
	echo "commentaire supprimer !<br/>";
	}
    break;
  default :
    echo "Action Invalide";
    break;
}
}
$query = "select * from commentaires where valide != 'oui'";
$rslt_query = mysql_query($query);

while ($val = mysql_fetch_array($rslt_query))
{
echo '<table border="1">';
echo '<tr><td>nom</td><td>'.$val['nom'].'</td></tr>';
echo '<tr><td>email</td><td>'.$val['email'].'</td></tr>';
echo '<tr><td>commentaire</td><td>'.$val['commentaire'].'</td></tr>';
echo '<tr><td>rating</td><td>'.$val['rating'].'</td></tr>';
echo '<tr><td>valide</td><td>'.$val['valide'].'</td></tr>';
echo '</table><br/>';
echo '<a href="?id='.$val['id'].'&amp;action=valider">Valider</a> ';
echo '<a href="?id='.$val['id'].'&amp;action=supprimer">Supprimer</a>';
}
?>
</body>
</html>